 
clear all
import delimited using "processed/mmquasi.csv", clear
ren year datayear
merge m:1 datayear using processed/pricemerge_dis.dta
ren datayear year 


gen logby1 = log(by1m)
gen logby2 = log(by2m)

xtset bin year

gen logby1_t1 = l.logby1
gen logby2_t1 = l.logby2


gen dlogby1 = logby1 - logby1_t1
gen dlogby2 = logby2 - logby2_t1
gen dlogby12 = dlogby1 - dlogby2

xtset bin year
foreach n of numlist 1/17 {
    gen logprice`n'=log(price`n')  
    gen dlogp`n' = logprice`n' - l.logprice`n'     
}

drop if logby1_t1 ==0
drop if logby2_t1 ==0
gen dlogpy = dlogp17-dlogp10
*
// excluding 10 and 17
local numlist_exc "1 2 3 4 5 6 7 8 9 11 12 13 14 15 16"

rename bin pct1000
gen dum20 = 0
replace dum20 = 1 if year <= 1994


foreach n of local numlist_exc {
    gen dlogp = dlogp`n'

    * Run regressions and store results
    reghdfe dlogby12 dlogp, cluster(pct1000) noabsorb
	
    reghdfe dlogby12 dlogp, cluster(pct1000) absorb(pct1000)

    reghdfe dlogby12 dlogp, cluster(pct1000) absorb(pct1000 dum20)

    reghdfe dlogby12 dlogp, cluster(pct1000) absorb(pct1000##dum20)

    reghdfe dlogby12 dlogp  dlogpy, cluster(pct1000) noabsorb

    reghdfe dlogby12 dlogp dlogpy, cluster(pct1000) absorb(pct1000)

    reghdfe dlogby12 dlogp dlogpy, cluster(pct1000) absorb(pct1000 dum20)

    reghdfe dlogby12 dlogp dlogpy, cluster(pct1000) absorb(pct1000##dum20)
	drop dlogp

}
